/* **********************************************************************************
 *
 * Copyright (c) TMF.AscendedThemeKit.Unthemed.NET Project. All rights reserved.
 *
 * This source code is subject to terms and conditions of the Shared Source License
 * for TMF.AscendedThemeKit.Unthemed. A copy of the license can be found in the License.html file
 * at the root of this distribution. If you can not locate the Shared Source License
 * for TMF.AscendedThemeKit.Unthemed, please send an email to ascend_adm@hotmail.com.
 * By using this source code in any fashion, you are agreeing to be bound by
 * the terms of the Shared Source License for TMF.AscendedThemeKit.Unthemed.NET.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * **********************************************************************************/

using TMF.AscendedThemeKit.Unthemed.Resources;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TMF.AscendedThemeKit.Unthemed.Windows.Forms.Design
{
    /// <summary>
    /// Provides the base class for types that define a list of items used to create a DesignerActionPanel.
    /// </summary>
    public class GradientSplitBarActionList : DesignerActionList
    {
        private GradientSplitBar _gradientSplitBar;

        /// <summary>
        /// Specifies if the control is anti-aliased when drawn.
        /// </summary>
        public bool AntiAlias
        {
            get
            {
                return this._gradientSplitBar.AntiAlias;

            }

            set
            {
                this.GetPropertyByName("AntiAlias").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// Specifies the position and manner in which a control is docked.
        /// </summary>
        /// <remarks>
        /// <para>
        /// When a control is docked to an edge of its container, it is always positioned flush against that edge when the container is resized. If more than one control is docked to an edge, the controls appear side by side according to their z-order; controls higher in the z-order are positioned farther from the container's edge.
        /// </para>
        /// <para>
        /// If Left, Right, Top, or Bottom is selected, the specified and opposite edges of the control are resized to the size of the containing control's corresponding edges. If Fill is selected, all four sides of the control are resized to match the containing control's edges.
        /// </para>
        /// </remarks>
        /// <value>
        /// <para>
        /// System.Windows.Forms.DockStyle
        /// </para>
        /// <para>
        /// This property is read/write.
        /// </para>
        /// </value>
        public DockStyle Dock
        {
            get
            {
                return this._gradientSplitBar.Dock;

            }

            set
            {
                this.GetPropertyByName("Dock").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// Specifies the number of bumps to be drawn on the split bar.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Negative numbers will be converted to 0. If a bump count number is greater than the surface allows, only the amount that can be drawn will be drawn.
        /// </para>
        /// </remarks>
        /// <value>
        /// <para>
        /// System.Int32
        /// </para>
        /// <para>
        /// This property is read/write.
        /// </para>
        /// </value>
        public int BumpCount
        {
            get
            {
                return this._gradientSplitBar.BumpCount;

            }

            set
            {
                this.GetPropertyByName("BumpCount").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// Gets or sets the gradient high (lighter) color for the control.
        /// </summary>
        /// <value>
        /// <para>
        /// System.Drawing.Color . A Color that represents the gradient high color of the control.
        /// </para>
        /// <para>
        /// This property is read/write. 
        /// </para>
        /// </value>
        public Color GradientHighColor
        {
            get
            {
                return this._gradientSplitBar.GradientHighColor;

            }

            set
            {
                this.GetPropertyByName("GradientHighColor").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// Gets or sets the gradient low (darker) color for the control.
        /// </summary>
        /// <value>
        /// <para>
        /// System.Drawing.Color . A Color that represents the gradient low color of the control.
        /// </para>
        /// <para>
        /// This property is read/write. 
        /// </para>
        /// </value>
        public Color GradientLowColor
        {
            get
            {
                return this._gradientSplitBar.GradientLowColor;

            }

            set
            {
                this.GetPropertyByName("GradientLowColor").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// The name of the control
        /// </summary>
        /// <value>
        /// System.String
        /// </value>
        public string Name
        {
            get
            {
                return (string)this._gradientSplitBar.Name;

            }

            set
            {
                this.GetPropertyByName("Name").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// Specifies the direction the split bar should be drawn.
        /// </summary>
        /// <value>
        /// <para>
        /// GradientSplitBarDirection
        /// </para>
        /// <para>
        /// This property is read/write.
        /// </para>
        /// </value>
        public GradientSplitBarDirection Direction
        {
            get
            {
                return this._gradientSplitBar.Direction;

            }

            set
            {
                this.GetPropertyByName("Direction").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// Gets or sets the painting style applied to the background in a control.
        /// </summary>
        /// <value>
        /// <para>
        /// This property is read/write. 
        /// </para>
        /// </value>
        public RenderMode RenderMode
        {
            get
            {
                return this._gradientSplitBar.RenderMode;

            }

            set
            {
                this.GetPropertyByName("RenderMode").SetValue(this._gradientSplitBar, value);

            }

        }

        /// <summary>
        /// Initializes a new instance of the GradientSplitBarActionList class.
        /// </summary>
        /// <param name="gradientSplitBar">A GradientSplitBar component.</param>
        public GradientSplitBarActionList(GradientSplitBar gradientSplitBar) : base(gradientSplitBar)
        {
            this._gradientSplitBar = gradientSplitBar;

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        private PropertyDescriptor GetPropertyByName(string propertyName)
        {
            PropertyDescriptor propertyDescriptor;

            propertyDescriptor = TypeDescriptor.GetProperties(this._gradientSplitBar)[propertyName];

            if (propertyDescriptor == null)
            {
                throw new ArgumentException(ResourceText.GetLocalizedString("GSBPropertyNotFoundExceptionText"));

            }
            else
            {
                return propertyDescriptor;

            }

        }

        /// <summary>
        /// Returns the collection of DesignerActionItem objects contained in the list. 
        /// </summary>
        /// <returns>A DesignerActionItem array that contains the items in this list.</returns>
        public override DesignerActionItemCollection GetSortedActionItems()
        {
            DesignerActionItemCollection items = new DesignerActionItemCollection();

            items.Add(new DesignerActionPropertyItem("Name", ResourceText.GetLocalizedString("ActionListDisplayNameName"), "Design", ResourceText.GetLocalizedString("NameDescription")));

            items.Add(new DesignerActionHeaderItem(ResourceText.GetLocalizedString("ActionListAppearanceCategory"), "Appearance"));
            items.Add(new DesignerActionTextItem(ResourceText.GetLocalizedString("ActionListAppearanceTextItem"), "Appearance"));
            items.Add(new DesignerActionPropertyItem("AntiAlias", ResourceText.GetLocalizedString("ActionListDisplayNameAntiAlias"), "Appearance", ResourceText.GetLocalizedString("AntiAliasDescription")));
            items.Add(new DesignerActionPropertyItem("RenderMode", ResourceText.GetLocalizedString("ActionListDisplayNameRenderMode"), "Appearance", ResourceText.GetLocalizedString("RenderModeDescription")));
            items.Add(new DesignerActionPropertyItem("GradientHighColor", ResourceText.GetLocalizedString("ActionListDisplayNameGradientHighColor"), "Appearance", ResourceText.GetLocalizedString("GradientHighColorDescription")));
            items.Add(new DesignerActionPropertyItem("GradientLowColor", ResourceText.GetLocalizedString("ActionListDisplayNameGradientLowColor"), "Appearance", ResourceText.GetLocalizedString("GradientLowColorDescription")));
            items.Add(new DesignerActionPropertyItem("BumpCount", ResourceText.GetLocalizedString("ActionListDisplayNameBumpCount"), "Appearance"));
            items.Add(new DesignerActionPropertyItem("Direction", ResourceText.GetLocalizedString("ActionListDisplayNameDirection"), "Appearance"));

            items.Add(new DesignerActionHeaderItem(ResourceText.GetLocalizedString("ActionListLayoutCategory"), "Layout"));
            items.Add(new DesignerActionTextItem(ResourceText.GetLocalizedString("ActionListLayoutTextItem"), "Layout"));
            items.Add(new DesignerActionPropertyItem("Dock", ResourceText.GetLocalizedString("ActionListDisplayNameDock"), "Layout"));

            return items;

        }

    }

}
